home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
rdcf.exe
/
FILES.DOC
< prev
next >
Wrap
Text File
|
1993-01-15
|
15KB
|
421 lines
FILES - A Small File and Directory Manipulation Utility for DOS
by Philip J. Erdelsky
PLAIN VANILLA CORPORATION
CompuServe 75746,3411
InterNet 75746.3411@compuserve.com
January 15, 1993
PUBLIC DOMAIN -- NO RESTRICTIONS ON USE
1. Introduction
---------------
The FILES utility is a small file and directory manipulation utility for DOS
(versions 2.00 and later). It was written mainly to test RDCF 2.0 and
duplicates a number of DOS internal and external commands, but it adds enough
functions to DOS to be useful in itself.
Here is what you can do with the FILES utility that you cannot do with DOS
commands alone:
(1) You can see hidden, system and deleted files and volume labels in
directory listings. (You can see hidden and system files, but not
deleted files, with DOS 5.0.)
(2) You can change the date and time of a file, directory or volume
label.
(3) You can sort a directory.
(4) You can restore a deleted file, if the file is not fragmented and has
not been overwritten.
(5) You can move a file or subdirectory from one directory to another
without copying its data.
(6) You can recover remnants of deleted files in the empty data clusters.
(7) You can wipe out remnants of deleted files in empty data clusters so
they cannot be recovered later.
Some of these things can't be done even by special programs that issue DOS
calls. The FILES utility can do them only because it goes around the DOS file
system and accesses the disk on a sector-by-sector basis.
The FILES utility works with diskettes and hard disk partitions smaller than
32 megabytes. It will not work with larger partitions, such as those used by
DOS 4.00 and later versions of DOS, and it will not work with LAN drives.
IMPORTANT: The FILES utility does not recognize any current drive or
subdirectory. You will have to type an explicit drive specification for every
file, and, for a file not in the root directory, a complete directory path.
Contrary to the usual DOS practice, the directory path must NOT begin with a
backslash. Sorry about that.
The FILES utility and its source code are in the public domain, but the RDCF
2.0 file package is copyrighted. If you want to make changes to the FILES
utility for your own use, you will have to obtain RDCF 2.0. You may make
copies for your own use, but commercial use of RDCF 2.0 requires permission.
You will also need a third package called the Reentrant Cache System 1.1, but
that is also in the public domain.
The current version of the FILES utility treats drives other than A: and B: as
read-only. You can change that if you know what you're doing.
2. Bringing up the FILES Utility
--------------------------------
The FILES utility resides in the file FILES.EXE. Copy this file from the
distribution diskette, or download it from a BBS.
Make sure the file FILES.EXE is in the current directory, or in a directory
made accessible by the DOS PATH command, and type
FILES
in response to the DOS prompt.
The FILES utility will then display its prompt:
FILES>
Enter FILES commands just as you would enter DOS commands, using the backspace
key to make corrections. If you have installed a DOS command line editor, it
will probably work with the FILES utility because the utility uses the same
DOS system call (number 10) as the DOS command line interpreter.
It is presumed that you are reasonably conversant with DOS commands.
You can execute FILES commands from a file by simply redirecting the file to
the FILES utility as its standard input; e.g.,
FILES <file
Be sure to end the file with an EXIT command, or you'll have to reboot to
regain control of your computer!
If you use this technique, remember that the command file is being read by DOS,
not by the FILES utility. Do not include FILES commands that write to the
drive on which the command file resides. The FILES utility and DOS will not
cooperate.
If you can't remember the FILES commands, just type HELP in response to the
FILES> prompt. Here is what you'll see:
COPY source destination
DATE file month-day-year hour:min:sec
DEL file
DIR directory
DIRSORT directory
EXIT
HELP
MD directory
MCOPY files directory
MOVE source destination
RECOVER file
REN old new
TYPE file
UNDEL file
VOLUME name
WIPE drive
2.1. COPY - Copy a File
-----------------------
The FILES command
COPY source destination
copies one file to another, just the way DOS does. However, you cannot copy
multiple files, and you must supply complete file specifications. For
example, to copy the file FOO.C from drive A: to the subdirectory \PROG on
drive B:, you must type
COPY A:FOO.C B:PROG\FOO.C
For file copying, you'll probably prefer to use DOS.
2.2. DATE - Change the Date and Time of a File, Directory or Volume
-------------------------------------------------------------------
The FILES command
DATE file month-day-year hour:min:sec
changes the date and time of a file or subdirectory. The date and time are
expressed in numerical form, and a 24-hour clock is used. To change the date
and time of the file A:FOO.C to September 15, 1992, 3:15 PM, type
DATE A:FOO.C 9-15-92 15:13:00
If the file specifications represent a subdirectory, its date and time will be
changed. That's something DOS won't do!
If you use a drive specification only, the date and time of the volume label
will be changed.
2.3 DEL - Delete a File, Directory or Volume
--------------------------------------------
The FILES command
DEL file
deletes the specified file. If the file specifications represent a
subdirectory, it deletes the subdirectory (provided it is empty). Hence it
does the work of both the DOS DEL and RD commands.
If you use a drive specification only, the volume label will be deleted.
2.4. DIR - Directory Listing
----------------------------
The FILES command
DIR directory
lists the contents of the specified directory, including volume labels, hidden
and system files, subdirectories and deleted volume labels, files and
subdirectories.
If you use a drive specification only, contents of the root directory will be
displayed.
To pause the display, type Ctrl-S; to abort the display, type Ctrl-C.
2.5. DIRSORT - Sort a Directory
-------------------------------
The FILES command
DIRSORT directory mode
sorts the entries in the specified directory in the specified manner.
The mode may be any ONE of the following:
mode manner of sort
---- -----------------------------------------------------------------
E sort by extension, then among files that have the same extension,
sort by name
D sort by date and time (earlier files first)
N sort by name, then among files that have the same name, sort by
extension
S sort by size (smallest files first)
The letter R may be appended to any of these modes to sort in the opposite
order. For example, SR sorts the files by size, but it puts the largest files
first.
If you omit the mode, N is presumed.
Actually, before the FILES utility sorts the directory entries, it first
divides them into five groups and arranges them in the following order:
(1) The two system files at the beginning of the root directory and the
two special files "." and ".." at the beginning of a subdirectory are
always left where they are.
(2) The volume label, if any, is put next.
(3) The subdirectory entries, if any, are sorted and put next.
(4) The file entries are sorted and put next.
(5) The entries for del